From b6f3a3cbf014b7adb992ffa697aca568ff7a7fcb Mon Sep 17 00:00:00 2001 From: Tim Deegan Date: Thu, 16 Aug 2012 14:31:09 +0100 Subject: [PATCH] x86/mm: update max_mapped_pfn on MMIO mappings too. max_mapped_pfn should reflect the highest mapping we've ever seen of any type, or the tests in the lookup functions will be wrong. As it happens, the highest mapping has always been a RAM one, but this is no longer the case when we allow 64-bit BARs. Reported-by: Xudong Hao Signed-off-by: Tim Deegan Committed-by: Tim Deegan --- xen/arch/x86/mm/p2m-ept.c | 2 +- xen/arch/x86/mm/p2m-pt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index f373905dd1..49c044e59f 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -428,7 +428,7 @@ ept_set_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn, } /* Track the highest gfn for which we have ever had a valid mapping */ - if ( mfn_valid(mfn_x(mfn)) && + if ( p2mt != p2m_invalid && (gfn + (1UL << order) - 1 > p2m->max_mapped_pfn) ) p2m->max_mapped_pfn = gfn + (1UL << order) - 1; diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c index 6193e72f10..5e7035f6a9 100644 --- a/xen/arch/x86/mm/p2m-pt.c +++ b/xen/arch/x86/mm/p2m-pt.c @@ -454,7 +454,7 @@ p2m_set_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn, } /* Track the highest gfn for which we have ever had a valid mapping */ - if ( mfn_valid(mfn) + if ( p2mt != p2m_invalid && (gfn + (1UL << page_order) - 1 > p2m->max_mapped_pfn) ) p2m->max_mapped_pfn = gfn + (1UL << page_order) - 1; -- 2.30.2